<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-user-reserve">
        <input id="roomId" name="roomId" type="hidden" th:value="${room.id}"/>
        <div class="form-group">
            <label class="col-sm-3 control-label ">房间编号：</label>
            <div class="col-sm-8">
                <input class="form-control" type="text" readonly name="roomCode" th:value="${room.code}"/>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label ">预定天数：</label>
            <div class="col-sm-8">
                <input class="form-control" type="text" id="stopDay" name="stopDay" th:value="1"/>
            </div>
        </div>
    </form>
</div>
<div th:include="include :: footer"></div>
<script type="text/javascript">
    $("#form-user-reserve").validate({
        rules: {
            stopDay: {
                required: true,
                minlength: 1,
                maxlength: 3
            }
        },
        focusCleanup: true
    });
    var prefix = ctx + "system/customer";
    function submitHandler() {
        if ($.validate.form()) {
            var roomId = $("#roomId").val();
            var stopDay = $("#stopDay").val();
            $.modal.confirm("确认预定该房间吗？", function () {
                $.operate.save(prefix + "/reserve", {"roomId": roomId, "stopDay": stopDay});
            })
        }
    }
</script>
</body>

</html>
